//
//  ZDBRankListHeaderView.m
//  ZDB
//
//  Created by 微笑吧阳光 on 2020/3/16.
//  Copyright © 2020 ZDB. All rights reserved.
//

#import "ZDBRankListHeaderView.h"
#import "ZDBRankListModel.h"
@implementation ZDBRankListHeaderView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

-(void)awakeFromNib{
    
    [super awakeFromNib];
    
    KViewRadius(self.header1, 36);
    KViewRadius(self.header2, 28);
    KViewRadius(self.header3, 28);
    
    
}
-(void)refushRankInfoData:(NSArray *)dataArry{
    
    NSDictionary * dicc1 = [dataArry firstObject];
    NSDictionary * dicc2 = [dataArry objectAtIndex:1];
    NSDictionary * dicc3 = [dataArry lastObject];
    
    self.moreNum1.text = [NSString stringWithFormat:@"  额外奖励%@  ",[dicc1 jsonString:@"value"]];
    self.moreNum2.text = [NSString stringWithFormat:@"  额外奖励%@  ",[dicc2 jsonString:@"value"]];
    self.moreNum3.text = [NSString stringWithFormat:@"  额外奖励%@  ",[dicc3 jsonString:@"value"]];
    
    KViewBorder(self.moreNum1, [UIColor colorWithHexString:@"#999999"], 0.5);
    KViewBorder(self.moreNum2, [UIColor colorWithHexString:@"#999999"], 0.5);
    KViewBorder(self.moreNum3, [UIColor colorWithHexString:@"#999999"], 0.5);
    
    KViewRadius(self.moreNum1, 6);
    KViewRadius(self.moreNum2, 6);
    KViewRadius(self.moreNum3, 6);
}
-(void)refushData:(NSArray *)dataArry{
    
    switch (dataArry.count) {
        case 0:
        {
            self.name1.text = @"暂无";
            self.number1.text = @"¥0";
            self.name2.text = @"暂无";
            self.number2.text = @"¥0";
            self.name3.text = @"暂无";
            self.number3.text = @"¥0";
        }
            break;
            case 1:
              {
            ZDBRankListModel * fristModel = dataArry.firstObject;
            self.name1.text = fristModel.nikeName;
            self.number1.text = [NSString stringWithFormat:@"¥%ld",[fristModel.money integerValue]];
            [self.header1 sd_setImageWithURL:[NSURL URLWithString:fristModel.headImage] placeholderImage:PlaceHolderImage];
                  
                self.name2.text = @"暂无";
                self.number2.text = @"¥0";
                self.name3.text = @"暂无";
                self.number3.text = @"¥0";
                  
            
            }
                  break;
            case 2:
              {
                  ZDBRankListModel * fristModel = dataArry.firstObject;
                  self.name1.text = fristModel.nikeName;
                  self.number1.text = [NSString stringWithFormat:@"¥%ld",[fristModel.money integerValue]];
                  [self.header1 sd_setImageWithURL:[NSURL URLWithString:fristModel.headImage] placeholderImage:PlaceHolderImage];
                  
                  ZDBRankListModel * secModel = dataArry[1];
                  self.name2.text = secModel.nikeName;
                  self.number2.text = [NSString stringWithFormat:@"¥%ld",[secModel.money integerValue]];
                  [self.header2 sd_setImageWithURL:[NSURL URLWithString:secModel.headImage] placeholderImage:PlaceHolderImage];
                  
                  self.name3.text = @"暂无";
                  self.number3.text = @"¥0";

                  
              }
                  break;
            case 3:
              {
                ZDBRankListModel * fristModel = dataArry.firstObject;
                 self.name1.text = fristModel.nikeName;
                 self.number1.text = [NSString stringWithFormat:@"¥%ld",[fristModel.money integerValue]];
                 [self.header1 sd_setImageWithURL:[NSURL URLWithString:fristModel.headImage] placeholderImage:PlaceHolderImage];
                 
                ZDBRankListModel * secModel = dataArry[1];
                self.name2.text = secModel.nikeName;
                self.number2.text = [NSString stringWithFormat:@"¥%ld",[secModel.money integerValue]];
                [self.header2 sd_setImageWithURL:[NSURL URLWithString:secModel.headImage] placeholderImage:PlaceHolderImage];
                ZDBRankListModel * thdModel = dataArry[2];
                self.name3.text = thdModel.nikeName;
                self.number3.text = [NSString stringWithFormat:@"¥%ld",[thdModel.money integerValue]];
                [self.header3 sd_setImageWithURL:[NSURL URLWithString:thdModel.headImage] placeholderImage:PlaceHolderImage];
                  
              }
                  break;
            
        default:
            break;
    }
    
    
    
    
    
}

@end
